package com.ktg.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ktg.ktgcommon.domain.wms.WmOutsourceIssue;
import com.ktg.ktgcommon.domain.wms.WmWarehouse;
import com.ktg.ktgcommon.filter.TokenVerifyFilter;
import com.ktg.mapper.WasMapper;
import com.ktg.service.WasService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class WasServiceImpl implements WasService {
    @Resource
    WasMapper wasMapper;
    @Override
    public int addWas(WmWarehouse wmWarehouse) {
        wmWarehouse.setCreateBy(TokenVerifyFilter.getUserName().getUsername());
        wmWarehouse.setCreateTime(new Date());
        return wasMapper.addWas(wmWarehouse);
    }

    @Override
    public int editWas(WmWarehouse wmWarehouse) {
        TokenVerifyFilter tokenVerifyFilter=new TokenVerifyFilter();
        wmWarehouse.setUpdateBy(tokenVerifyFilter.getUserName().getUsername());
        wmWarehouse.setUpdateTime(new Date());
        return wasMapper.editWas(wmWarehouse);
    }

    @Override
    public WmWarehouse selectById(Integer wareHouseId) {
        return wasMapper.selectById(wareHouseId);
    }
    @Override
    public Page<WmWarehouse> getUserByPage(Page<WmWarehouse> page, WmWarehouse wmWarehouse) {
        return wasMapper.getByWasPage(page,wmWarehouse);
    }
}
